package nl.ypmits.utils.as3.view {
	import flash.display.DisplayObject;
	import flash.display.Sprite;
	import flash.geom.Rectangle;

	/**
	 * @author Dave Lenz
	 */
	public class BoxSizer extends Sprite {

		public static function sizer( objToSize : DisplayObject, rectTo : Rectangle ) : void {
			var maxhoogte : Number = rectTo.height;
			objToSize.height = maxhoogte;
			objToSize.scaleX = objToSize.scaleY;
			if( objToSize.width < rectTo.width ) {
				objToSize.width = rectTo.width;
				objToSize.scaleY = objToSize.scaleX;
			}
			objToSize.x = rectTo.width * .5;
			objToSize.y = maxhoogte * .5;
		}
	}
}
